﻿using DevExpress.XtraGrid.Views.Grid;

namespace Inaction.UI.Extensions.ControlExtensions.Grid
{
    class GridViewDetailHelper
    {
        public void Extend(GridView gridView)
        {
            gridView.MasterRowGetChildList += new MasterRowGetChildListEventHandler(masterView_MasterRowGetChildList);
        }

        static void masterView_MasterRowGetChildList(object sender, MasterRowGetChildListEventArgs e)
        {
            var gridView = sender as GridView;
            var detailView = gridView.GetDetailView(e.RowHandle, e.RelationIndex);
            if (detailView != null)
            {
                detailView.RefreshData();
            }
        }
    }
}
